package com.ftwj.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;
@Data
public class UserAppointmentInfo {
    private String  id;
    //场所id
    private String  placeId;
    //教室id
    private String  roomId;
    //座位编号
    private String  seatId;
    //座位id
    private String  seatCode;
    //人员id
    private String  userId;
    //开始时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;
    //结束时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;
    //座位状态(1:已预约,2:使用中,3:已释放)
    private Integer  appointmentState;
    //备注
    private String  mark;
    //创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    //更新时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;
    //状态(-1删除，1正常)
    private Integer state;
    private String placeName;

    private String roomName;

    private String seatName;

    public boolean isEndTimeValid() {
        long diffInMillis = this.endTime.getTime() - this.startTime.getTime();
        long diffInMinutes = diffInMillis / (60 * 1000);
        return diffInMinutes >= 30;
    }

}
